#include <bits/stdc++.h>
using namespace std;
// -----------------------------------------------------------------
void test(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
// -----------------------------------------------------------------
#define FastIO cin.tie(0);cout.tie(0);ios::sync_with_stdio(0);
#define printv(v) for(auto x:v){cout<<x<<" ";}cout<<endl;
#define dbg(x) cout<<#x<<" = "<<x<<endl;
#define SQ(a) (a)*(a)
#define PB push_back
#define S second
#define F first
// -----------------------------------------------------------------
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> mi;
typedef vector<vii> mii;
// --------------------------------------
typedef long long ll;
typedef pair<ll, ll> pll;
typedef vector< ll > vll;
typedef vector< pll > vpll;
typedef vector< vll > mll;
typedef vector< vpll > mpll;
typedef unsigned long long ull;
typedef long double ld;
// --------------------------------------
const ll INF = 9223372036854775807;
const int OO = 2147483647;
const ll MOD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.141592653589793238;
const int TOW = 0b10;
const int FIFTEEN = 0xf;
int tc = 1;
// -----------------------------------------------------------------
const int N = 3e5 + 5e3;
ll n, m, q, t, r, c, x;
stack<pair<ii,ii>> v;
int ans[105][105];
// --------------------------------------
void row(int i){
int z = ans[i][m-1];
for(int j = m-1 ; j > 0 ; j --) ans[i][j] = ans[i][j-1];
ans[i][0] = z;
}
void col(int j){
int z = ans[n-1][j];
for(int i = n-1 ; i > 0 ; i --) ans[i][j] = ans[i-1][j];
ans[0][j] = z;
}
// --------------------------------------
void doTest(){
cin>>n>>m>>q;
for(int i = 0 ; i < q ; i ++){
cin>>t;
if(t == 3){
cin>>r>>c>>x; r--; c--;
v.push({{t, r}, {c, x}});
}else{
cin>>x; x--;
v.push({{t, x}, {0, 0}});
}
}
while(!v.empty()){
pair<ii,ii> k = v.top(); v.pop();
if(k.F.F == 1) row(k.F.S);
else if(k.F.F == 2) col(k.F.S);
else if(k.F.F == 3) ans[k.F.S][k.S.F] = k.S.S;
}
for(int i = 0 ; i < n ; i ++){
for(int j = 0 ; j < m ; j ++)
cout<<ans[i][j]<<" ";
cout<<"\n";
}
}
// --------------------------------------
int main(){
test();
FastIO
cout<<fixed<<setprecision(15);
// scanf("%d", &tc);
// cin>>tc;
while(tc--) doTest();
}
// -----------------------------------------------------------------
1605B - Reverse Sort | 1607C - Minimum Extraction |
1604B - XOR Specia-LIS-t | 1606B - Update Files |
1598B - Groups | 1602B - Divine Array |
1594B - Special Numbers | 1614A - Divan and a Store |
2085. Count Common Words With One Occurrence | 2089. Find Target Indices After Sorting Array |
2090. K Radius Subarray Averages | 2091. Removing Minimum and Maximum From Array |
6. Zigzag Conversion | 1612B - Special Permutation |
1481. Least Number of Unique Integers after K Removals | 1035. Uncrossed Lines |
328. Odd Even Linked List | 1219. Path with Maximum Gold |
1268. Search Suggestions System | 841. Keys and Rooms |
152. Maximum Product Subarray | 337. House Robber III |
869. Reordered Power of 2 | 1593C - Save More Mice |
1217. Minimum Cost to Move Chips to The Same Position | 347. Top K Frequent Elements |
1503. Last Moment Before All Ants Fall Out of a Plank | 430. Flatten a Multilevel Doubly Linked List |
1290. Convert Binary Number in a Linked List to Integer | 1525. Number of Good Ways to Split a String |